package com.example.toolbar.utils;

import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class imgUtils {

	public static int getImgNum(String source) {
		int count = 0;
		String regex = ".jpg";
		Pattern p = Pattern.compile(regex);// 编译regex
		Matcher m = p.matcher(source);// 匹配regx
		while (m.find()) {// 是否查找到下一个结果
			count++;
		}
		return count;
	}

	public static ArrayList<String> getImgUrl(String source) {
		ArrayList<String> urls = new ArrayList<String>();
		String regex = "assets.+?jpg";
		Pattern p = Pattern.compile(regex);// 编译regex
		Matcher m = p.matcher(source);// 匹配regx
		while (m.find()) {// 是否查找到下一个结果
			urls.add(m.group());
		}
		return urls;
	}
	public static String[] getImageUrl(String source){
		String[] urls=source.split(",");
		return urls;
	}
}